import request from '@/utils/request'

export function getGroups(flag) {
  let url = 'web/zabbix/hostgroup/get'
  if (flag) {
    url += '?flag=true'
  }
  return request({
    url: url,
    method: 'get'
  })
}

export function getHosts(groupId) {
  let url = 'web/zabbix/host/get'
  if (groupId) {
    url += '?groupids=' + groupId
  }
  return request({
    url: url,
    method: 'get'
  })
}

export function getGraphs(hostId) {
  let url = 'web/zabbix/graph/get'
  if (hostId) {
    url += '?hostids=' + hostId
  }
  return request({
    url: url,
    method: 'get'
  })
}

export function getImage(imageId) {
  const url = 'web/zabbix/graph/image'
  return request({
    url: url,
    method: 'get'
  })
}
